<?php
/**
 * Created by PhpStorm.
 * User:  aLuckyfellow<136171154@qq.com>
 * Date: 2019-04.29
 * Time: 上午16:04
 */

abstract class ActionBasePlugin extends Yaf_Action_Abstract
{

    abstract public function main();

    public function execute()
    {
        $this->main();
    }

    protected function setSuccess($data = NULL, $code = 200)
    {
        $this->getResponse()->setHeader('Content-Type', 'application/json;charset=utf8');

        $this->getResponse()->setBody(json_encode([
            "code" => $code,
            "data" => $data
        ], JSON_UNESCAPED_UNICODE));
    }

    protected function _getParams()
    {
        return $this->getRequest()->getParams();
    }
}